//
// Created by jsjxsy on 2022/8/12.
//
#include <stdio.h>
#include <string.h>
int main(void) {
  char *str = "hello world";
  char *result = strchr(str, 'w');
  printf("result = %s\n", result);
  char *mResult = memchr(str, 'w',sizeof(str));
  printf("mResult = %s\n", mResult);

  char a[] = {'0','1','2','3','4','\0'};
  char* temp2 = memchr(a, 48, 5);  // 48 对应的是ASCII码表中的 '0'
  printf("%s\n", temp2);  // (null

  // 比较数组大小
  int a1[] = {2,2,0,4,5};
  int b1[] = {2,2,3,4,5};
  int result2 = memcmp(a1, b1, 8);
  printf("a?b: %d\n", result2);  // a?b: 0

  int result3 = memcmp(a1, b1, 9);
//  int result3 = memcmp(a1, b1, 12);
  printf("a?b: %d\n", result3);

  return 0;
}
